import request from '@/utils/request'
// 登录注册
export function getUser (data) {
  return request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data
  })
}

// 获取验证码
export const getVerificationCode = () => request('/v1_0/sms/codes/18612345678')
// 关注作者和取消关注
export function followAuthor (authorId, isFollow) {
  // 关注
  if (isFollow) {
    return request({
      url: '/v1_0/user/followings',
      method: 'post',
      data: { target: authorId }
    })
  // 取消关注
  } else {
    return request({
      url: '/v1_0/user/followings/' + authorId,
      method: 'delete'
    })
  }
}
